﻿using System;
using System.Web.UI.WebControls;
using ASPNETVN.PORTAL.Components.Helpers;
using ASPNETVN.PORTAL.Components.Security;
using ASPNETVN.PORTAL.Components.UI;

namespace ASPNETVN.PORTAL.Modules.DOWNLOAD.Controls
{
    public partial class AddToForum : AddEditModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (this.ItemID > 0)
            {
                Components.Item item = Components.Item.Load(this.ItemID);
                if (item != null)
                {
                    item.Description = Server.HtmlDecode(item.Description);
                    item.InsertToForum(Convert.ToInt32(cbForum.SelectedItem.Value), Convert.ToInt32(PortalSecurity.CurrentUser.Identity.ID));
                    Response.Redirect(HttpUrlBuilder.BuildUrl(this.ModuleID, 0, ModulePages.ItemManager));
                    
                }
            }
        }

        protected void sdsForum_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            sdsForum.SelectParameters["PortalID"].DefaultValue = Global.PortalID.ToString();
        }
    }
}